package com.FindYou.Service.Impl;

import com.FindYou.Dao.UserDao;
import com.FindYou.Service.UserService;
import com.FindYou.utils.StaticFactoryBean;
import org.junit.Test;

/**
 * @Title: UserServiceImpl
 * @Author 贾金博
 * @Package com.FindYou.Service.Impl
 * @Date 2024/11/8 上午9:22
 * @description: 实现类
 */
public class UserServiceImpl implements UserService {

    private UserDao userDao;

    // 写有产构造的时候 最好在加上一个无参构造
    public UserServiceImpl() {

    }
    public UserServiceImpl(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public void save() {
        UserDao userDao = StaticFactoryBean.createUserDao();
        userDao.save();
    }

    /**
     * 通过无参数进行 注入bean
     */
    public void save2() {
        userDao.save();
    }



}
